package com.sxbbc.common.core.enums;

import java.util.ArrayList;
import java.util.List;

import com.sxbbc.common.basics.utils.calculation.CalcuUtils;

/**
 * @author xiaoky
 * @description 支付方式枚举
 * @date 2019-05-14
 */
public enum PayTypeEnums {
	PAY_ZFB(1,"支付宝"),
	PAY_WX(2,"微信"),
	PAY_MONEY(3, "余额"),
	PAY_POINT(4, "积分");
	
	private Integer id;
	 
    private String name;
    
    public Integer getId() {
		return id;
	}
	
	public void setId(Integer id) {
		this.id = id;
	}
	
	public String getName() {
		return name;
	}
	
	public void setName(String name) {
		this.name = name;
	}
 
	private PayTypeEnums(Integer id,String name){
		this.id=id;
		this.name=name;
	}
	
	public static String getName(Integer id){
		String str="";
		for(PayTypeEnums o:PayTypeEnums.values()){
			if(CalcuUtils.getInstance().isEquals(id, o.getId())){
				str= o.getName();
				break;
			}
		}
		return str;
	}
	
	public static List<PayTypeEnums> queryList(){
		List<PayTypeEnums> list=new ArrayList<PayTypeEnums>();
		for(PayTypeEnums o:PayTypeEnums.values()){
			list.add(o);
		}
		return list;
	}
	
	
	public static PayTypeEnums getEnums(Integer paytype){
		for(PayTypeEnums o:PayTypeEnums.values()){
			if(CalcuUtils.getInstance().isEquals(paytype, o.getId())){
				return o;
			}
		}
		return null;
	}
	
	
	public static boolean isPay(Integer id) {
		for(PayTypeEnums o:PayTypeEnums.values()){
			if(CalcuUtils.getInstance().isEquals(id, o.getId())){
				return true;
			}
		}
		return false;
	}
}
